import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
// import styleImport, { AntResolve } from 'vite-plugin-style-import'

// import path from "path"
import * as path from "path"

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    react(),
    // styleImport({
    //   resolves: [
    //     AntResolve()
    //   ]
    // })
  ],
  resolve: {
    alias: {
      "@": path.resolve(__dirname, './src')
    }
  },
  server: {
    proxy: {
      '/api': {
        target: 'http://localhost:3000',	//后台地址
        ws: true,
        changeOrigin: true, //开启跨域
        rewrite: (path) => path.replace(/^\/api/, '/back')
      },

    }
  }
})
